package editorsvg.propiedades.tabla;

import editorsvg.propiedades.Configuracion;
import java.awt.Component;
import java.io.Serializable;
import javax.swing.AbstractCellEditor;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

 
class EditorCeldaPropiedades extends AbstractCellEditor implements Serializable,TableCellRenderer, TableCellEditor
{

    static final long serialVersionUID = Configuracion.version; 
    public EditorCeldaPropiedades() {
        super();
    }
 
    private JComponent getComponenteDelModelo(JTable table, int row, int column)  {
        Object obj = table.getModel().getValueAt(row, column);
        
        if (obj instanceof JComponent) {
            return ((JComponent) obj);
        }
        return null;
    }
    
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        // De momento solo se hace en la columna 2
        return getComponenteDelModelo(table, row, column);
    }
 
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        return getComponenteDelModelo(table, row, column);
    }
 
    public Object getCellEditorValue() {
        return null;
    }
}